Imports System
Imports DotNetNuke

Namespace Bring2mind.DNN.Modules.UserFiles.Data

 Public MustInherit Class DataProvider

#Region " Shared/Static Methods "

  ' singleton reference to the instantiated object 
  Private Shared objProvider As DataProvider = Nothing

  ' constructor
  Shared Sub New()
   CreateProvider()
  End Sub

  ' dynamically create provider
  Private Shared Sub CreateProvider()
   objProvider = CType(Framework.Reflection.CreateObject("data", "Bring2mind.DNN.Modules.UserFiles.Data", ""), DataProvider)
  End Sub

  ' return the provider
  Public Shared Shadows Function Instance() As DataProvider
   Return objProvider
  End Function

#End Region

#Region " Files Methods "
  Public MustOverride Function GetFiles(ByVal id As Integer, ByVal portalId As Integer) As IDataReader
  Public MustOverride Function AddFiles(ByVal dateSubmitted As Date, ByVal fileLength As Integer, ByVal fileName As String, ByVal portalId As Integer, ByVal userId As Integer) As Integer
  Public MustOverride Sub UpdateFiles(ByVal id As Integer, ByVal dateSubmitted As Date, ByVal fileLength As Integer, ByVal fileName As String, ByVal portalId As Integer, ByVal userId As Integer)
  Public MustOverride Sub DeleteFiles(ByVal id As Integer)
#End Region

#Region " Other Procedures "
  Public MustOverride Function GetAllPortalFiles(ByVal PortalId As Integer) As IDataReader
  Public MustOverride Function GetFileByFilename(ByVal FileName As String, ByVal UserId As Integer, ByVal PortalId As Integer) As IDataReader
  Public MustOverride Function GetMyFiles(ByVal UserId As Integer, ByVal PortalId As Integer) As IDataReader
  Public MustOverride Function GetMyTotal(ByVal UserId As Integer, ByVal PortalId As Integer) As Integer
#End Region

 End Class

End Namespace

